// import Cookie from 'js-cookie'
import { category, Brand, Banner, New, Hot } from '@/api/http'
export default {
    state: {

        categoryList: [],
        fixed: false,
        Band: [],
        Banner: [],
        NewData: [],
        HotData:[]

    },
    mutations: {
        updatCategoryList(state, val) {
            state.categoryList = val

        },
        updataFixed(state, val) {
            state.fixed = val
        },
        updataBand(state, val) {
            state.Band = val
        },
        updataBanner(state, val) {
            state.Banner = val
            console.log('banner', state.Banner)
        },
        updataNewData(state, val) {
            state.NewData = val
            console.log('NewData', state.NewData)
        },
        updataHotData(state, val) {
            state.HotData = val
            console.log('NewData', state.NewData)
        },
    },
    actions: {
        async getCategoryList(store) {
            const { data: res } = await category()
            console.log(res.result)
            store.commit('updatCategoryList', res.result)
            console.log('state.categoryList', store.state.categoryList)
        },
        async getBrand(store) {
            const { data: res } = await Brand()
            console.log('res', res)


        },


        async getBanner(store) {
            const { data: res } = await Banner()
            console.log('res', res)
            store.commit('updataBanner', res.result)
            // console.log('Banner'.store.state.Banner)
            // $refs.hidden.css('display', 'block')
        },
        async getNew(store) {
            const  { data: res } = await New()
            console.log('New', res)
            store.commit('updataNewData', res.result)
        },
        async getHot(store) {
            const  { data: res } = await Hot()
            console.log('HotData', res)
            store.commit('updataHotData', res.result)
        },


    }
}

